/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyfntbreqviatico")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyfntbreqviatico.findAll", query = "SELECT p FROM Pyfntbreqviatico p"),
    @NamedQuery(name = "Pyfntbreqviatico.findByPyfntbreqviaticoid", query = "SELECT p FROM Pyfntbreqviatico p WHERE p.pyfntbreqviaticoid = :pyfntbreqviaticoid"),
    @NamedQuery(name = "Pyfntbreqviatico.findByRequerimiento", query = "SELECT p FROM Pyfntbreqviatico p WHERE p.requerimiento = :requerimiento"),
    @NamedQuery(name = "Pyfntbreqviatico.findByFecharegistro", query = "SELECT p FROM Pyfntbreqviatico p WHERE p.fecharegistro = :fecharegistro"),
    @NamedQuery(name = "Pyfntbreqviatico.findByObservaciones", query = "SELECT p FROM Pyfntbreqviatico p WHERE p.observaciones = :observaciones")})
public class Pyfntbreqviatico implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyfntbreqviaticoid")
    private Integer pyfntbreqviaticoid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "requerimiento")
    private String requerimiento;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecharegistro")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecharegistro;
    @Size(max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbreqviaticoid")
    private Collection<Pyfntbviatmont> pyfntbviatmontCollection;
    @JoinColumn(name = "pyfntbpoaprogid", referencedColumnName = "pyfntbpoaprogid")
    @ManyToOne(optional = false)
    private Pyfntbpoaprog pyfntbpoaprogid;
    @JoinColumn(name = "pyfntbpartidaid", referencedColumnName = "pyfntbpartidaid")
    @ManyToOne(optional = false)
    private Pyfntbpartida pyfntbpartidaid;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbreqviaticoid")
    private Collection<Pyfntbpedviatic> pyfntbpedviaticCollection;

    public Pyfntbreqviatico() {
    }

    public Pyfntbreqviatico(Integer pyfntbreqviaticoid) {
        this.pyfntbreqviaticoid = pyfntbreqviaticoid;
    }

    public Pyfntbreqviatico(Integer pyfntbreqviaticoid, String requerimiento, Date fecharegistro) {
        this.pyfntbreqviaticoid = pyfntbreqviaticoid;
        this.requerimiento = requerimiento;
        this.fecharegistro = fecharegistro;
    }

    public Integer getPyfntbreqviaticoid() {
        return pyfntbreqviaticoid;
    }

    public void setPyfntbreqviaticoid(Integer pyfntbreqviaticoid) {
        this.pyfntbreqviaticoid = pyfntbreqviaticoid;
    }

    public String getRequerimiento() {
        return requerimiento;
    }

    public void setRequerimiento(String requerimiento) {
        this.requerimiento = requerimiento;
    }

    public Date getFecharegistro() {
        return fecharegistro;
    }

    public void setFecharegistro(Date fecharegistro) {
        this.fecharegistro = fecharegistro;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    @XmlTransient
    public Collection<Pyfntbviatmont> getPyfntbviatmontCollection() {
        return pyfntbviatmontCollection;
    }

    public void setPyfntbviatmontCollection(Collection<Pyfntbviatmont> pyfntbviatmontCollection) {
        this.pyfntbviatmontCollection = pyfntbviatmontCollection;
    }

    public Pyfntbpoaprog getPyfntbpoaprogid() {
        return pyfntbpoaprogid;
    }

    public void setPyfntbpoaprogid(Pyfntbpoaprog pyfntbpoaprogid) {
        this.pyfntbpoaprogid = pyfntbpoaprogid;
    }

    public Pyfntbpartida getPyfntbpartidaid() {
        return pyfntbpartidaid;
    }

    public void setPyfntbpartidaid(Pyfntbpartida pyfntbpartidaid) {
        this.pyfntbpartidaid = pyfntbpartidaid;
    }

    @XmlTransient
    public Collection<Pyfntbpedviatic> getPyfntbpedviaticCollection() {
        return pyfntbpedviaticCollection;
    }

    public void setPyfntbpedviaticCollection(Collection<Pyfntbpedviatic> pyfntbpedviaticCollection) {
        this.pyfntbpedviaticCollection = pyfntbpedviaticCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyfntbreqviaticoid != null ? pyfntbreqviaticoid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyfntbreqviatico)) {
            return false;
        }
        Pyfntbreqviatico other = (Pyfntbreqviatico) object;
        if ((this.pyfntbreqviaticoid == null && other.pyfntbreqviaticoid != null) || (this.pyfntbreqviaticoid != null && !this.pyfntbreqviaticoid.equals(other.pyfntbreqviaticoid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyfntbreqviatico[ pyfntbreqviaticoid=" + pyfntbreqviaticoid + " ]";
    }
    
}
